<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ page import="com.scalar.chiptrack.utils.ConfigManager" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/financeReport.do?action=costVariance"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext(); %>

<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/quickSearch.js"></script>
</HEAD>
<script language="javascript">


function submitReport()
{
    var form = document.finanaceReportForm;

    var pa = document.getElementById("message");
    pa.innerHTML = '&nbsp;';

    var d = new Date();
    var day = d.getDate();
    var month = d.getMonth()+1;
    var year = d.getFullYear();
    var hour = d.getHours();
    var min = d.getMinutes();
    var sec = d.getSeconds();

    var defaultPrompt = day+"/"+month+"/"+year+":"+hour+":"+min+":"+sec;

    var date1  =  form.costCostUpdateTime1.value;
    //var date2  = form.costCostUpdateTime2.value;
    var date2  = '';

    if ( date1 == '' )
    {
        pa.innerHTML = '<li>No cost code files are uploaded</li>';
        return;
    }

    /*if( date1 !='' && date2 !='')
    {
        if (!validateDateOut(formatDateAsMMDDYYYY(date2),formatDateAsMMDDYYYY(date1)))
        {
            pa.innerHTML = "<Li>UpdatedTime1 cannot be less than UpdatedTime2</li>";
            return;
        }
     }*/


    var url = '<%=chipTracContext%>/operationsDataDumpReports.do?action=costVarianceXlReport&popUp=true&date1=' + date1 + '&date2=' + date2 + '&timestamp=' + defaultPrompt;

    newWindow = window.open ( url, 'costVarianceXlReport', 'channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=450,height=150,resizable=yes');
}
     
function ResetMessages()
{
    var form = document.finanaceReportForm;

    var pa = document.getElementById("message");

    if ( pa.innerHTML != '&nbsp;')
    {
       pa.innerHTML = '&nbsp;';
    }   

}
function ExportToExcel()
{
    var form = document.finanaceReportForm;

    var d = new Date();
    var day = d.getDate();
    var month = d.getMonth()+1;
    var year = d.getFullYear();
    var hour = d.getHours();
    var min = d.getMinutes();
    var sec = d.getSeconds();

    var defaultPrompt = day+"/"+month+"/"+year+":"+hour+":"+min+":"+sec;

    var date1  =  form.costCostUpdateTime1.value;
    var date2  = form.costCostUpdateTime2.value;
    var url = '<%=chipTracContext%>/operationsDataDumpReports.do?action=costVarianceXlReport&popUp=true&date1=' + date1 + '&date2=' + date2 + '&timestamp=' + defaultPrompt;

    newWindow = window.open ( url, 'costVarianceXlReport', 'channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=450,height=150,resizable=yes');

}

</script>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" >
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
    <!-- Side Navigation start -->
    <%@ include file="/jsp/finance/finance_reports_menu.jsp" %>
    <!-- end of the side navigations -->
    </TD>
    <TD bgcolor="#ffffff">
        <IMG height="9" src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width="8"></TD>
        <TD bgcolor="#ffffff"><IMG height=460 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width="2"></TD>
        <TD valign="top" width="100%">
        <IMG height="1" src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width="500" border="0">
        <BR>
        <html:form name="finanaceReportForm" type = "com.scalar.chiptrack.finance.reports.forms.FinanaceReportForm" action = "/financeReport.do">
        <TABLE border="0" width="100%" align="center">
            <TR><TD colspan="5" class="NArialW" align="center">Cost Variance Report&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR>
            <TR><TD colspan="5">&nbsp;</TD></TR>
            <TR><TD colspan="5" class='NArialL' align="left"><strong><FONT id="message" styleClass="NArialL" color='FF0000'>&nbsp;</FONT></strong></TD></TR>
            <TR>
                <TD colspan="5">
                    <TABLE align="center" border="0" width="100%" cellspacing="3" cellpadding="2">
                        <TR>
                            <TD width="45%" class="NArialL" align = "right">Schedule Time : </TD>
                            <TD colspan="4" width="55%" class="NArialL" align="left">
                                <html:select property="costCostUpdateTime1" styleClass="txfield" onchange="javascript:ResetMessages()">
                                    <%--<html:option value="-1">Scheduled Time</html:option>--%>
                                    <html:options collection="updateTimeList" property="value" labelProperty="label"/>
                                </html:select>
                            </TD>
                        </TR>

                       <%-- <TR>
                            <TD width="20%" class="NArialL" align = "right">Schedule Time1</TD>
                            <TD width="20%" class="NArialL" align = "left">
                                <html:select property="costCostUpdateTime1" styleClass="txfield" onchange="javascript:ResetMessages()">
                                    --%><%--<html:option value="-1">Scheduled Time</html:option>--%><%--
                                    <html:options collection="updateTimeList" property="value" labelProperty="label"/>
                                </html:select>
                            </TD>

                            <TD width="20%" class="NArialL" align = "right"><!--Schedule Time2--></TD>
                            <TD width="20%" class="NArialL" align = "left">
                                <html:select property="costCostUpdateTime2" styleClass="txfield" onchange="javascript:ResetMessages()" >
                                    --%><%--<html:option value="-1">Scheduled Time</html:option>--%><%--
                                    <html:options collection="updateTimeList" property="value" labelProperty="label"/>
                                </html:select>
                            </TD>
                             <TD colspan="1">&nbsp;</TD>
                        </TR>--%>
                        <TR><TD colspan="5"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></TD></TR>
                       <%--<TR><td nowrap colspan="4" align = "right" class="NArialL" ><a href= "javascript:ExportToExcel();">Export To Excel</a> </td>
                           <TD colspan="1">&nbsp;</TD>
                       </TR>--%>
                        <TR><TD colspan="5"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></TD></TR>
                                              
                        <TR>
                            <TD colspan="5" align="center" valign="top">
                                <a href="javascript:submitReport();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53" height="17" onmouseover="window.status='Click to Generate Customer Report';return true" onmouseout="window.status='';return true" title='Click to Generate Customer Report'></a>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <a href="javascript:document.finanaceReportForm.reset();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to reset';return true" onmouseout="window.status='';return true" title="Click here to reset"></a>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </TD>
                         </TR>
                        <TR><TD colspan="5"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></TD></TR>
                    </TABLE>
                </TD>
            </TR>
        </TABLE>
        </html:form>
       </TD>
    </TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>

